//
//  HZOrderGoodsEmptyView.m
//  app
//
//  Created by 刘华舟 on 15/5/7.
//  Copyright (c) 2015年 hdaren. All rights reserved.
//

#import "HZOrderGoodsEmptyView.h"

#import "HZImageSourceConstant.h"


static const NSInteger kOrderEmptyPicHeight = 240;
static const NSInteger kOrderEmptyShortDescpLabelHeight = 80;

static NSString * const kOrderEmptyShortDescpText = @"订单无效，请返回重新下单";


@interface HZOrderGoodsEmptyView()

@property (strong, nonatomic) UIImageView *picImgView;
@property (strong, nonatomic) UILabel *shortDesLabel;


@end


@implementation HZOrderGoodsEmptyView

- (instancetype)initWithFrame:(CGRect)frame{
    if (self = [super initWithFrame:frame]) {
        
        //self.backgroundColor = HZ_MALL_M_LIGHT_GRAY_BACKGROUND_COLOR;
        self.backgroundColor = [UIColor whiteColor];
        
        //背景图片
        self.picImgView = [[UIImageView alloc] initWithFrame:CGRectOf([self.ubo fx:UB_CENTER ux:-kOrderEmptyPicHeight/2 fy:UB_CENTER uy:-kOrderEmptyPicHeight*2/3] ,
                                                                      [self.ubo uw:kOrderEmptyPicHeight uh:kOrderEmptyPicHeight])];
        [self.picImgView setImage:[UIImage imageNamed:kImageMallLogo]];
        [self addSubview:self.picImgView];

        //短描述
        self.shortDesLabel = [[UILabel alloc] initWithFrame:CGRectOf([self.ubo fx:UB_LEFT oy:self.picImgView.ufo.yy],
                                                                     [self.ubo fw:UB_WIDTH uh:kOrderEmptyShortDescpLabelHeight])];
        self.shortDesLabel.text = kOrderEmptyShortDescpText;
        self.shortDesLabel.textAlignment = NSTextAlignmentCenter;
        self.shortDesLabel.font = JKAppGlobleFontContentText;
        self.shortDesLabel.textColor = HZ_MALL_TEXT_M_LIGHTGRAY_COLOR;
        [self addSubview:self.shortDesLabel];
    
    }
    return self;
}

- (void)show{
    self.hidden = NO;
    self.shortDesLabel.text = kOrderEmptyShortDescpText;
}

- (void)showWithMessage:(NSString *)message{
    self.hidden = NO;
    if (message) {
        self.shortDesLabel.text = message;
    }else{
        self.shortDesLabel.text = kOrderEmptyShortDescpText;
    }
}


- (void)hide{
    self.hidden = YES;
}

@end
